home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / misc / amag / am9305b.lha / Tips & Tricks / font.c < prev    next >
C/C++ Source or Header  |  1993-03-23  |  933b  |  44 lines

  1. /* Aufruf vom CLI: CheckFont <fontname>
  2.  * z.B. CheckFont fonts:Lettergothic.font     */
  3.  
  4. #include <exec/types.h>
  5. #include <dos/dos.h>
  6. #include <diskfont/diskfont.h>
  7.  
  8. void CheckFont(char *fontname)
  9. {
  10.   BPTR FontFile;
  11.   UWORD fch_FileID;
  12.  
  13.   if (FontFile=Open(fontname,MODE_OLDFILE))
  14.   {
  15.     if (Read(FontFile,&fch_FileID,2)==2)
  16.     {
  17.       /* OFCH_ID hat den Wert 0x0f03. Definiert ist
  18.        * dieser in diskfont/diskfont.h.
  19.        * OFCH = Outline-Font-Contents-Header
  20.        */
  21.       if (fch_FileID==OFCH_ID)
  22.       {
  23.         /* Font ist ein Outline-Font */
  24.         printf("%s ist ein Outline-Font\n",fontname);
  25.       }
  26.       else
  27.       {
  28.         /* Font ist kein Outline-Font */
  29.         printf("%s ist kein Outline-Font\n",fontname);
  30.       }
  31.     }
  32.     Close(FontFile);
  33.   } else printf("Font %s existiert nicht\n",fontname);
  34. }
  35.  
  36. main(long argc,char **argv)
  37. {
  38.   if( argc == 2 )
  39.   {
  40.     /* Nur von CLI */
  41.     CheckFont(argv[1]);
  42.   }
  43. }
  44.